package map;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class MapDemo_1 {
    public static void main(String[] args) {
        Map<String,Integer > map = new HashMap<>();

        map.put("语文",80);
        map.put("数学",98);
        map.put("化学",98);
        map.put("生物",56);

        Set<String> keys = map.keySet();
      for (String key : keys){
          System.out.println(key);
      }
        Collection<Integer> values = map.values();
      for (Integer value : values){
          System.out.println(value);
      }
        System.out.println("------------");
values.forEach(

        v-> System.out.println(v)

);
 map.forEach(
         (k,v)-> System.out.println(k+ ":" + v)
 );

        Set<Map.Entry<String, Integer>> entries = map.entrySet();
        for (Map.Entry< String ,Integer> entry : entries){
            String key = entry.getKey();
            Integer value = entry.getValue();
            System.out.println(key + ":" + value);
        }


    }
}
